package gspushmq.v1.subscribe;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.CopyOnWriteArraySet;

import org.java_websocket.WebSocket;

import gspushmq.model.ApiMessage;
import gspushmq.model.ApiMessageType;
import gspushmq.model.Message;
import gspushmq.model.MessageType;
import gspushmq.model.User;


public class GGSubscribe {
	//=============================sys==============================
	/**
	 * 记录所有用户订阅了哪些api
	 */
//	public static ConcurrentHashMap<WebSocket, Set<Message>> socketMessMap = new ConcurrentHashMap<>();
	
	/**
	 * 消息类型对应的用户集合
	 */
	public static ConcurrentHashMap<MessageType, ConcurrentSkipListSet<Message>> messWocketMap = new ConcurrentHashMap<>();

	/**
	 * weboscket 与 用户信息的对应
	 */
	public static ConcurrentHashMap<WebSocket, User> wstUser = new ConcurrentHashMap<>();
	
	public static ConcurrentHashMap<WebSocket, Message> wstMessage = new ConcurrentHashMap<>();
	
	/**
	 * 记录已经更新了的api
	 */
	public static ConcurrentLinkedQueue<MessageType> activeQueue = new ConcurrentLinkedQueue<>();

	/**
	 * 记录需要逻辑处理的队列
	 */
	public static ConcurrentLinkedQueue<MessageType> sysHandlerQueue = new ConcurrentLinkedQueue<>();
	
	//=============================api======================================================
	
	/**
	 * api 一类消息和 用户集合的对应
	 */
	public static ConcurrentHashMap<ApiMessageType, ConcurrentSkipListSet<ApiMessage>> ApiUrlMessage = new ConcurrentHashMap<>();
	
	/**
	 * 记录需要逻辑处理的队列
	 */
	public static ConcurrentLinkedQueue<ApiMessageType> apiHandlerQueue = new ConcurrentLinkedQueue<>();
	/**
	 * 记录已经更新了的api
	 */
	public static ConcurrentLinkedQueue<ApiMessageType> apiActiveQueue = new ConcurrentLinkedQueue<>();

	//=============================互踢================================================
	/**
	 * 登录互踢
	 */
	public static ConcurrentHashMap<User, WebSocket> userWst = new ConcurrentHashMap<>();
}